<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link th:href="@{/js/navbar-fixed-top.css}" rel="stylesheet">
    <link th:href="@{/css/bootstrap.css}" type="text/css" rel="stylesheet">
    <style>
        body{
            background-color:lightgoldenrodyellow;
        }
        .title{
            margin: 10px 0;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top"  style="background-image: url(/img/bar.jpg)">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/index">移动学术论坛</span></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="/index">主页</a></li>
                <li><a href="#about">关于论坛</a></li>
                <li><img th:src="@{/img/money.png}" style="height: 18px;width: 18px;"></li>
                <li><a href="#love">打赏论坛</a></li>
            </ul>
            <!--/*@thymesVar id="userstatu" type=""*/-->
            <ul class="nav navbar-nav navbar-right" th:if="${userstatu}==0">
                <li><a href="/login">登录</a></li>
                <li><a href="/register">注册</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right" th:if="${userstatu}==1">
                <li><img th:src="'/'+${user.getImageAddr()}" style="height: 50px;width: 50px;border-radius: 50%"></li>
                <li><a th:href="${'/user/'+user.getUserId()}" th:text="${user.getUserName()}"></a></li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
<div class="container" style="margin-top: 60px">
    <div  style="width: 100%">
        <div style="float: left;height: 55px;width: 55px">
            <img th:src="'/'+${lookuser.getImageAddr()}" style="width: 100%;height: 100%;">
        </div>
        <div class="title" style="font-size: 30px;float: left;margin-left: 10px;"><p th:text="${lookuser.getUserName()}"></p></div>
    </div>
</div>
<div class="container">
    <hr/>
    <ul id="myTab" class="nav nav-tabs">
        <li class="active">
            <a href="#info" data-toggle="tab">个人信息</a>
        </li>
        <li>
            <a href="#postinfo" data-toggle="tab">我的贴子</a>
        </li>
    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade in active" id="info" >
            <div class="container" th:if="${lookuser.getUserName()==user.getUserName()}">
                <form th:action="'/user/'+${lookuser.getUserId()}" method="post">
                    <div class="form-group">
                        <label for="username">姓名：</label>
                        <input type="text" class="form-control" id="username" name="username" th:value="${lookuser.getUserName()}">
                    </div>
                    <div class="form-group">
                        <label for="username">密码：</label>
                        <input type="text" class="form-control" id="userpassword" name="userpassword"  th:value="${lookuser.getUserPassword()}">
                    </div>
                    <div class="form-group">
                        <label for="usersex">性别：</label>
                        <input type="text" class="form-control" id="usersex"  name="usersex" th:value="${lookuser.getUserSex()}">
                    </div>
                    <div class="form-group">
                        <label for="useremail">邮箱：</label>
                        <input type="email" class="form-control" id="useremail" name="useremail" th:value="${lookuser.getUserEmail()}">
                    </div>
                    <div class="form-group">
                        <label for="userqq">QQ：</label>
                        <input type="text" class="form-control" id="userqq" name="userqq"  th:value="${lookuser.getQq()}">
                    </div>
                    <div class="form-group">
                        <label for="userimg">头像：</label>
                        <input type="text" class="form-control" id="userimg" name="userimg" th:value="${lookuser.getImageAddr()}">
                    </div>
                    <button type="submit" class="btn btn-default">修改</button>
                </form>
            </div>
            <div class="container" th:if="${lookuser.getUserName()!=user.getUserName()}">
                <form >
                    <div class="form-group">
                        <label for="username">姓名：</label>
                        <input type="text" class="form-control" name="username" th:value="${lookuser.getUserName()}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="usersex">性别：</label>
                        <input type="text" class="form-control" name="usersex" th:value="${lookuser.getUserSex()}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="useremail">邮箱：</label>
                        <input type="email" class="form-control"name="useremail" th:value="${lookuser.getUserEmail()}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="userqq">QQ：</label>
                        <input type="text" class="form-control"  name="userqq"  th:value="${lookuser.getQq()}" disabled>
                    </div>
                </form>
            </div>
        </div>
        <div class="tab-pane fade" id="postinfo">
            <table class="table" >
                <thead>
                <tr>
                    <th>帖子名</th>
                    <th>作者</th>
                    <th>时间</th>
                </tr>
                </thead>
                <tbody th:each="p:${posts_list}">
                <tr>
                    <td ><a th:href="'/showposts/'+${p.getPostsId()}" th:text="${p.getPostsTitle()}"></a></td>
                    <td><a th:href="'/user/'+${lookuser.getUserId()}" th:text="${lookuser.getUserName()}"></a></td>
                    <td th:text="${p.getPostsDate()}"></td>
                </tr>
                </tbody>
            </table>
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li>
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
<script th:src="@{/js/jquery-3.3.1.js}"></script>
<script th:src="@{/js/bootstrap.js}"></script>
<script>
    $(function () {
        $('#myTab li:eq(0) a').tab('show');
    });
</script>

</body>
</html>